/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package toesp.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author satria.sp
 */
@Entity
@Table(name = "menu")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Menu.findAll", query = "SELECT m FROM Menu m")})
public class Menu implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "menu_id")
    private Integer menuId;
    @Basic(optional = false)
    @Column(name = "menu_name")
    private String menuName;
    @Basic(optional = false)
    @Column(name = "menu_title")
    private String menuTitle;
    @Basic(optional = false)
    @Column(name = "menu_parent")
    private int menuParent;
    @OneToMany(mappedBy = "menu")
    private List<Groupmenu> groupmenuList;

    public Menu() {
    }

    public Menu(Integer menuId) {
        this.menuId = menuId;
    }

    public Menu(Integer menuId, String menuName, String menuTitle, int menuParent) {
        this.menuId = menuId;
        this.menuName = menuName;
        this.menuTitle = menuTitle;
        this.menuParent = menuParent;
    }

    public Integer getMenuId() {
        return menuId;
    }

    public void setMenuId(Integer menuId) {
        this.menuId = menuId;
    }

    public String getMenuName() {
        return menuName;
    }

    public void setMenuName(String menuName) {
        this.menuName = menuName;
    }

    public String getMenuTitle() {
        return menuTitle;
    }

    public void setMenuTitle(String menuTitle) {
        this.menuTitle = menuTitle;
    }

    public int getMenuParent() {
        return menuParent;
    }

    public void setMenuParent(int menuParent) {
        this.menuParent = menuParent;
    }

    @XmlTransient
    public List<Groupmenu> getGroupmenuList() {
        return groupmenuList;
    }

    public void setGroupmenuList(List<Groupmenu> groupmenuList) {
        this.groupmenuList = groupmenuList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (menuId != null ? menuId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Menu other = (Menu) obj;
        if ((this.menuName == null) ? (other.menuName != null) : !this.menuName.equals(other.menuName)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "toesp.entity.Menu[ menuId=" + menuId + " ]";
    }
    
}
